package main

import (
	"path/filepath"
	"fmt"
	"os"
	"os/exec"
	"path"
)


func main() {
	dir, _ := filepath.Abs(`.`)
	fmt.Println(dir)

	file, _ := exec.LookPath(os.Args[0])

	//得到全路径，比如在windows下E:\\golang\\test\\a.exe
	c_path, _ := filepath.Abs(file)

	rst := filepath.Dir(c_path)
	fmt.Println( rst)

	wd, _ := os.Getwd()
	fmt.Printf("get cwd: %s \n", wd)
	fmt.Printf("dir of cwd: %s \n", path.Base(wd))

}
